import java.util.Arrays;


public class aa {
	public static boolean isPentagonal(long pentagonal[], long value) {
		if (Arrays.binarySearch(pentagonal, value) >= 0)
			return true;
		else
			return false;
	}
 
	public static void main(String[] args) {
		long pentagonal[] = new long[10000];
		for (long i=1; i<10000; i++) {
			pentagonal[(int)i] = (i*3*i - i)/2;
		}
 
		for (int i=1; i<10000; i++) {
			for (int j=1; j<i; j++) {
				if (isPentagonal(pentagonal, pentagonal[i]+pentagonal[j]) &&
					isPentagonal(pentagonal, pentagonal[i]-pentagonal[j])) {
					System.out.println("Difference is " + (pentagonal[i]-pentagonal[j]));
					System.exit(0);
				}
			}
		}
	}
}
